﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using KPIS.GERP.GIMS.BLL;
using KPIS.GERP.GIMS.IBLL;
using KPIS.GERP.GIMS.MODEL;
using System.Data;
using System.IO;
using System.Web.UI.HtmlControls;

namespace KPIS.GERP.GIMS.APP.APP_UI.Form
{
    public partial class ICM_Item_Request_Dtls : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            IncludeJava();



            if (!IsPostBack)
            {


                Session["icm_req_seq"] = Request.QueryString["seq"];
                initLabel();
                LoadDataGrid();

            }
        }

            
        private void initLabel()
        {

            int code = int.Parse(Session["icm_req_seq"].ToString());  
            DataTable dt;
            RequestBLL obj = new RequestBLL();
       //     dt = obj.SelectByCode(code); 
            //if(dt.Rows.Count >0) 
            //{


            //    //lblFromWH.Text = dt.Rows[0][""  
            //    lblDateWanted.Text = dt.Rows[0]["wanted_date"].ToString();  
            //    lblStatus.Text = dt.Rows[0]["status"].ToString() ;  
            //    lblInvType.Text = dt.Rows[0]["type_name"].ToString();
            //    lblFromWH.Text = dt.Rows[0]["icm_wh_name"].ToString();
            //    lblRemarks.Text = dt.Rows[0]["remarks"].ToString();
            //    lblReqName.Text = dt.Rows[0]["request_name"].ToString();
            //    lblReqCode.Text = dt.Rows[0]["icm_req_code"].ToString();
            //    lblReqDate.Text = dt.Rows[0]["request_date"].ToString();   


            //}


        }



        private void LoadDataGrid()
        {
            DataTable dt;
            //WF_FinanceInfoBLL obj = new WF_FinanceInfoBLL();
            RequestBLL obj = new RequestBLL();

            int icm_req_seq = int.Parse(Session["icm_req_seq"].ToString());

        //    dt = obj.SelectDtls(icm_req_seq);

            //RadGrid2.DataSource = dt;
            //RadGrid2.DataBind();
         
        }

        public void IncludeJava()
        {
            HtmlGenericControl script = new HtmlGenericControl();
            script.TagName = "script";
            script.Attributes.Add("type", "text/javascript");
            script.Attributes.Add("src", "../../Scripts/jsfunction.js");
            Page.Header.Controls.Add(script);
        }

        protected void RadGrid2_ItemCommand(object source, GridCommandEventArgs e)
        {
            try
            {

                if (e.CommandName == "btnClick")
                    return;

                if (e.CommandName == "Delete")
                {
                    int seq = Convert.ToInt32((e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["loan_seq"]);

                    //WF_FinanceInfoBLL obj = new WF_FinanceInfoBLL();
                    //obj.DeleteLoan(seq, 1);
                }
                LoadDataGrid();

            }
            catch (Exception ex)
            {
              //  Web.ShowAlert(this, ex.Message);
            }


        }

        protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
        {

        }

        protected void RadGrid2_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {

        }

        protected void Grid_SubItem_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {

        }

      

        protected void btnDeleteItem_Click(object sender, EventArgs e)
        {





        }

        protected void TreeItem_NodeClick(object sender, RadTreeNodeEventArgs e)
        {

        }

        protected void TreeItem_NodeExpand(object sender, RadTreeNodeEventArgs e)
        {




        }

        protected void btnSelectItem_Click(object sender, EventArgs e)
        {



        }


        
    }

}
